﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YunLian.Cache
{
    public enum ExpirationMode
    {
        /// <summary>
        /// 永不过期
        /// </summary>
        None=0,
        /// <summary>
        /// 空置时间，缓存时间会在缓存请求后重置
        /// </summary>
        Sliding=1,
        /// <summary>
        /// 缓存项会在过期时间后过期
        /// </summary>
        Absolute=2
    }
    public enum CacheItemRemovedReason
    {
        /// <summary>
        /// 过期
        /// </summary>
        Expired = 0,

        /// <summary>
        /// 由于空间有限
        /// </summary>
        Evicted = 1,

        /// <summary>
        /// 通过客户端手动执行
        /// </summary>
        ExternalDelete = 99
    }
    public enum CacheActionEventArgOrigin
    {
        /// <summary>
        /// 本机
        /// </summary>
        Local,

        /// <summary>
        /// 远程
        /// </summary>
        Remote
    }
    /// <summary>
    /// 缓存更新策略，当在当前缓存中发现缓存，决定是否同步更新到其他缓存组件
    /// </summary>
    public enum CacheUpdateMode
    {
       /// <summary>
       /// 不做任何操作
       /// </summary>
        None,
        /// <summary>
        /// 同步更新到其他缓存组件
        /// </summary>
        Up
    }
    public enum UpdateItemResultState
    {
        /// <summary>
        /// 成功
        /// </summary>
        Success,

        /// <summary>
        /// 更新失败，达到最大重试次数
        /// </summary>
        TooManyRetries,

        /// <summary>
        /// 缓存项不存在，更新失败
        /// </summary>
        ItemDidNotExist,

        /// <summary>
        /// 返回值错误.
        /// </summary>
        FactoryReturnedNull,
    }
}
